package com.dameng.work.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.dameng.work.mapper.SHELLMapper;
import com.dameng.work.pojo.SHELL;
import com.dameng.work.service.SHELLService;
import com.dameng.work.util.CustomUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.io.IOException;
import java.util.List;


@Service
public class SHELLServiceImpl implements SHELLService {


    @Autowired
    private SHELLMapper sHELLMapper;


    @Override
    public List<SHELL> findAllList() {
        List<SHELL> tabnums = sHELLMapper.selectList(new QueryWrapper<>());
        return tabnums;
    }

    @Override
    public SHELL InsertRandomShell() throws IOException {
        SHELL shell = new SHELL();
        shell.setSHELL_ID(CustomUtil.getUUID());
        shell.setNAME(CustomUtil.getChineseName());
        shell.setPASSWORD(CustomUtil.getTel());
        shell.setMOBILE(String.valueOf(CustomUtil.getNotSimple(7)));
        shell.setTELEPHONE(CustomUtil.getTel());
        sHELLMapper.insert(shell);

        return shell;
    }
}
